package abacab.router;

import com.typesafe.config.Config;
import com.typesafe.config.ConfigException;

/**
 * The factory handling the creation of the round robin router
 * 
 * @param <M>
 *          the type of message
 */
public class RoundRobinRouterFactory<M> implements RouterFactory<M> {
	@Override
	public Router<M> buildRouter(Config config) throws ConfigException {
		if (config.getBoolean("shared-queue")) {
			return new RoundRobinRouterShared<M>(config.getInt("actors"));
		}
		return new RoundRobinRouter<M>(config.getInt("actors"));
	}
}